package com.kstech.ks_gaz01.carChoose

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.kstech.ks_gaz01.databinding.LayoutItemCarBinding

/**
 * author: blankii
 * created on: 2024/4/25 16:05
 * description:
 */
class CarsAdapter : BaseQuickAdapter<String, CarsAdapter.VH>() {
    class VH(
        parent: ViewGroup,
        val binding: LayoutItemCarBinding = LayoutItemCarBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onBindViewHolder(holder: VH, position: Int, item: String?) {
//        if (item!!.contains(XML_DEVICE_NAME_GWH23)) {
//            holder.binding.carName.text = XML_DEVICE_NEW_NAME_GWH23
//        } else {
//
//        }
        holder.binding.carName.text = item!!.substring(0, item.indexOf("."))
    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        return VH(parent)
    }
}